Thursday, May 10, 2007

ExceptionMatching.java

ExceptionMatching.java

public class ExceptionMatching {
public static void main(String[] args) {
try {
throw new Exception();
} catch(ArrayIndexOutOfBoundsException e) {
System.err.println("Caught 1");
} catch(IndexOutOfBoundsException e) {
System.err.println("Caught 2");
} catch(RuntimeException e) {
System.err.println("Caught 3");
} catch(Exception e) {
System.err.println("Caught 4");
}
}
}

ExceptionMatching.java output

Caught 4

Tag: Study Code Program Java

No comments:

Post a Comment